def welcome():
    print('-'*20)
    print('欢迎登录学员管理系统')
    print('1:添加学员')
    print('2:删除学员')
    print('3:修改学员')
    print('4:查询学员信息')
    print('5:显示所有学员信息')
    print('6:退出系统')
    print('-'*20)




def add_info():
    new_id=input('请输入学号:')
    new_name = input('请输入姓名:')
    new_tel = input('请输入电话:')
    for e in info:
        if new_id==e['id'] or new_name ==e['name']:
            print('该用户已存在，你太失败了')
            return
    dict1={}
    dict1['id']=new_id
    dict1['name'] = new_name
    dict1['tel'] = new_tel
    info.append(dict1)
    print(f'添加成功！学员信息：{info}')


def del_info(del_name):

    # del_id = input('请输入学号:')

    # del_tel = input('请输入电话:')
    for e in info:
        if del_name == e['name']:
            info.remove(e)
            print('删除成功')
            break
    else:
        print('该用户不存在，你太失败')
    print(info)


def modify_info(mod_name):
    for e in info:
        if(mod_name==e['name']):

            mod_tel = input('请输入电话:')
            e['tel'] = mod_tel
            print('修改成功')
            break
    else:
        print('该用户不存在，你太失败')
    print(info)



def select_info(sel_name):
    for e in info:
       if(sel_name==e['name']):
           print(e)
           break
    else:
        print('该用户不存在，你太失败')
    print(info)


def select_all():
    print(info)



info=[];
while True:
    welcome()
    choose=input('请选择功能序号：')
    if choose=='1':
        add_info()
    elif choose =='2':
        del_name = input('请输入要删除的学员姓名:')
        del_info(del_name)
    elif choose =='3':
        mod_name = input('请输入要修改的学员姓名:')
        modify_info(mod_name)
    elif choose =='4':
        sel_name = input('请输入要查看的学员姓名:')
        select_info(sel_name)
    elif choose =='5':
        select_all()
    elif choose =='6':
        flag=input('确定要退出？yes or no:')
        if flag =='yes':
            break
    else:
        print('输入有误！重新选择')